	varying vec3 vertexNormal;
	varying vec3 vertexDirection;
	varying vec3 vertexReflectDir;
	varying vec3 viewDirection;
	
	uniform sampler2D depthTexture;
	varying vec4 q;
	
	float specularFactor = 20.0;
	
	void main()
	{
		float phong = max( dot(normalize(vertexNormal),normalize(vertexDirection)), 0.0);
		
		float specular = 1.0;
//		if(phong > 0.0)
//		{
//			specular = pow(max(dot(vertexReflectDir,viewDirection),0.0), specularFactor);
//		}
		
		vec3 coord = 0.5 * (q.xyz / q.w + 1.0);
		float shadow = 1.0;
		float depth = texture2D(depthTexture, coord.st).r;
		if( coord.z > depth)
			shadow = 0.0;								
		gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0) * shadow;		
		float value = (phong + specular) * shadow;
		
		gl_FragColor = vec4(value, value, value, 1.0);
	}